# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
-# $Id$
include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=miniupnpd
-PKG_VERSION:=1.1
-PKG_RELEASE:=5.2
-PKG_MD5SUM:=a0f6651476721db9b554668c8c83b151
+PKG_VERSION:=1.4
+PKG_RELEASE:=1
+PKG_MD5SUM:=ffa33d4ed8732c662bdb7d511e86db76
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
CATEGORY:=Network
DEPENDS:=+iptables
TITLE:=Lightweight UPnP daemon
- URL:=http://miniupnp.tuxfamily.org/
+ URL:=http://miniupnp.free.fr/
+endef
+
+define Package/miniupnpd/conffiles
+/etc/config/upnpd
endef
define Build/Compile
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/firewall
$(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/bin/miniupnpd
$(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
- $(INSTALL_DATA) ./files/upnpd.config $(1)/etc/config/upnpd
+ $(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
$(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/firewall/50-miniupnpd
endef
--- /dev/null
+--- a/netfilter/iptcrdr.c
++++ b/netfilter/iptcrdr.c
+@@ -424,10 +424,20 @@ delete_redirect_and_filter_rules(unsigne
+ if(h)
+ {
+ r = delete_rule_and_commit(index, h, miniupnpd_nat_chain, "delete_redirect_rule");
++#ifdef IPTABLES_143
++ iptc_free(h);
++#else
++ iptc_free(&h);
++#endif
+ }
+ if((r == 0) && (h = iptc_init("filter")))
+ {
+ r = delete_rule_and_commit(index, h, miniupnpd_forward_chain, "delete_filter_rule");
++#ifdef IPTABLES_143
++ iptc_free(h);
++#else
++ iptc_free(&h);
++#endif
+ }
+ }
+ del_redirect_desc(eport, proto);
+++ /dev/null
-Index: Makefile.openwrt
-===================================================================
-RCS file: /usr/local/cvsroot/miniupnp/miniupnpd/Makefile.openwrt,v
-retrieving revision 1.11
-diff -u -r1.11 miniupnpd-1.1/Makefile.openwrt
---- miniupnpd-1.1.orig/Makefile.openwrt 29 Jan 2008 12:52:03 -0000 1.11
-+++ miniupnpd-1.1/Makefile.openwrt 1 May 2008 22:34:28 -0000
-@@ -6,7 +6,7 @@
- # your openwrt SDK/etc...
- # http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=713
-
--include $(TOPDIR)/rules.mk
-+#include $(TOPDIR)/rules.mk
- #CFLAGS = -Wall -O -D_GNU_SOURCE -g
- #CFLAGS = -Wall -Os -D_GNU_SOURCE
- #CC = mipsel-linux-gcc
-@@ -16,7 +16,8 @@
- CP = cp
- RM = rm -f
- INSTALL = install
--IPTABLESINC=$(BUILD_DIR)/iptables-1.3.3/include
-+IPTABLESINC=$(STAGING_DIR)/usr/include
-+#IPTABLESINC=$(BUILD_DIR)/iptables-1.3.3/include
- #IPTABLESINC=$(TOPDIR)/../iptables-1.3.3/include
-
- BASEOBJS = miniupnpd.o upnphttp.o upnpdescgen.o upnpsoap.o \
-@@ -28,7 +29,7 @@
- NETFILTEROBJS = netfilter/iptcrdr.o
- ALLOBJS = $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS)
-
--LIBS = $(BUILD_DIR)/iptables-1.3.3/libiptc/libiptc.a
-+#LIBS = $(BUILD_DIR)/iptables-1.3.3/libiptc/libiptc.a
- #LIBS = $(TOPDIR)/../iptables-1.3.3/libiptc/libiptc.a
-
- TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
+++ /dev/null
-Index: miniupnpd-1.1/netfilter/iptables_init.sh
-===================================================================
---- miniupnpd-1.1.orig/netfilter/iptables_init.sh 2007-09-17 17:43:54.000000000 -0500
-+++ miniupnpd-1.1/netfilter/iptables_init.sh 2007-09-17 17:43:54.000000000 -0500
-@@ -1,9 +1,12 @@
- #! /bin/sh
- # $Id: iptables_init.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $
-+. /etc/functions.sh
- IPTABLES=iptables
-
- #change this parameters :
--EXTIF=eth0
-+include /lib/network
-+scan_interfaces
-+config_get EXTIF wan ifname
- EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
- echo "External IP = $EXTIP"
-
-Index: miniupnpd-1.1/netfilter/iptables_removeall.sh
-===================================================================
---- miniupnpd-1.1.orig/netfilter/iptables_removeall.sh 2007-09-17 17:43:54.000000000 -0500
-+++ miniupnpd-1.1/netfilter/iptables_removeall.sh 2007-09-17 17:43:54.000000000 -0500
-@@ -1,9 +1,12 @@
- #! /bin/sh
- # $Id: iptables_removeall.sh,v 1.3 2006/11/23 12:32:57 nanard Exp $
-+. /etc/functions.sh
- IPTABLES=iptables
-
- #change this parameters :
--EXTIF=eth0
-+include /lib/network
-+scan_interfaces
-+config_get EXTIF wan ifname
- EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
-
- #removing the MINIUPNPD chain for nat
+++ /dev/null
-Index: miniupnpd-1.1/config.h.openwrt
-===================================================================
-RCS file: /usr/local/cvsroot/miniupnp/miniupnpd/miniupnpd-1.1/config.h.openwrt,v
-retrieving revision 1.2
-diff -u -r1.2 miniupnpd-1.1/config.h.openwrt
---- miniupnpd-1.1/config.h.openwrt 26 Apr 2007 19:11:09 -0000 1.2
-+++ miniupnpd-1.1/config.h.openwrt 1 May 2008 22:47:17 -0000
-@@ -1,18 +1,27 @@
- /* $Id: miniupnpd-1.1/config.h.openwrt,v 1.2 2007/04/26 19:11:09 nanard Exp $ */
- /* MiniUPnP Project
- * http:///miniupnp.free.fr
-- * (c) 2006 Thomas Bernard
-+ * (c) 2006-2008 Thomas Bernard
- */
- #ifndef __CONFIG_H__
- #define __CONFIG_H__
-
- #define UPNP_VERSION "20070228"
--
-+#define USE_NETFILTER 1
- #define OS_NAME "OpenWRT"
- /* OS/version */
--#define OS_VERSION "OpenWRT/WhiteRussian"
-+#define OS_VERSION "OpenWRT/kamikaze"
- #define OS_URL "http://openwrt.org/"
-
- #define LOG_MINIUPNPD LOG_DAEMON
-+
-+/* Comment the following line to disable NAT-PMP operations */
-+#define ENABLE_NATPMP
-+
-+/* Comment the following line to use home made daemonize() func instead
-+ * of BSD daemon() */
-+#define USE_DAEMON
-+
-+#define ENABLE_L3F_SERVICE
-
- #endif
+++ /dev/null
-Index: miniupnpd-1.1/netfilter/iptcrdr.c
-===================================================================
---- miniupnpd-1.1.orig/netfilter/iptcrdr.c 2008-03-03 02:41:28.000000000 +0100
-+++ miniupnpd-1.1/netfilter/iptcrdr.c 2009-09-28 21:14:48.000000000 +0200
-@@ -371,11 +371,21 @@
- if(h)
- {
- r = delete_rule_and_commit(index, &h, "delete_redirect_rule");
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- }
- h = iptc_init("filter");
- if(h && (r == 0))
- {
- r = delete_rule_and_commit(index, &h, "delete_filter_rule");
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- }
- }
- del_redirect_desc(eport, proto);
-@@ -465,20 +475,40 @@
- {
- syslog(LOG_ERR, "%s : iptc_is_chain() error : %s\n",
- logcaller, iptc_strerror(errno));
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- return -1;
- }
- if(!iptc_append_entry(miniupnpd_chain, e, &h))
- {
- syslog(LOG_ERR, "%s : iptc_append_entry() error : %s\n",
- logcaller, iptc_strerror(errno));
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- return -1;
- }
- if(!iptc_commit(&h))
- {
- syslog(LOG_ERR, "%s : iptc_commit() error : %s\n",
- logcaller, iptc_strerror(errno));
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- return -1;
- }
-+#ifdef IPTABLES_143
-+ iptc_free(h);
-+#else
-+ iptc_free(&h);
-+#endif
- return 0;
- }
-